package com.digitalchina.lxnsy.api;

import android.app.Activity;
import android.os.Handler;

import com.digitalchina.lxnsy.constant.MSG;
import com.digitalchina.lxnsy.constant.URL;
import com.digitalchina.lxnsy.toolkit.OkHttpUtil;
import com.lzy.okhttputils.model.HttpParams;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.api
 * 创建人：郑皓
 * 创建时间：2018/2/7 15:03
 * 修改备注：
 * ================================================
 */
public class BusinessConsultDynamic {





    /**
     * 获取咨询动态列表（第一级）
     *
     * @param activity
     * @param handler
     */
    public static void queryListPage(Activity activity, int page, int limit,String keyWords, Handler handler) {

        HttpParams params = new HttpParams();
        params.put("page", String.valueOf(page));
        params.put("perPage", String.valueOf(limit));
        params.put("keyWords", keyWords);
        OkHttpUtil.get(activity, URL.URL_queryListPage, "", params, handler, MSG.MSG_QUERY_CONSULT_LIST_SUCCESS, MSG.MSG_QUERY_CONSULT_LIST_FIELD);

    }


    public static void queryDetail(Activity activity,String chipNo, Handler handler) {

        HttpParams params = new HttpParams();

        params.put("chipNo", chipNo);
        OkHttpUtil.get(activity, URL.URL_queryDetail, "", params, handler, 1011, 1012);

    }


    /**
     * 获取咨询动态列表（第一级）
     *
     * @param activity
     * @param handler
     */
    public static void queryConsultList(Activity activity, int page, int limit,String queryDataType, Handler handler) {

        HttpParams params = new HttpParams();
        params.put("page", String.valueOf(page));
        params.put("perPage", String.valueOf(limit));
        params.put("queryDataType", queryDataType);
        OkHttpUtil.get(activity, URL.URL_QUERY_CONSULT_LIST, "", params, handler, MSG.MSG_QUERY_CONSULT_LIST_SUCCESS, MSG.MSG_QUERY_CONSULT_LIST_FIELD);

    }

    /**
     * 获取咨询动态回复列表（第二级）
     *
     * @param activity
     * @param id 咨询ID，第一级返回的ID
     * @param handler
     */
    public static void queryDetails(Activity activity, String id, Handler handler) {

        HttpParams params = new HttpParams();

        OkHttpUtil.get(activity, URL.URL_QUERY_DETAILS+id, "", params, handler, MSG.MSG_QUERY_CONSULT_DETAILS_SUCCESS, MSG.MSG_QUERY_CONSULT_DETAILS_FIELD);

    }

    /**
     * 获取咨询动态回复列表（第二级）
     *
     * @param activity
     * @param consultInfoId 咨询ID，第一级返回的ID
     * @param page
     * @param limit
     * @param handler
     */
    public static void queryConsultDetails(Activity activity, String consultInfoId, int page, int limit, Handler handler) {

        HttpParams params = new HttpParams();
        params.put("consultInfoId", consultInfoId);
        params.put("page", String.valueOf(page));
        params.put("limit", String.valueOf(limit));

        OkHttpUtil.post(activity, URL.URL_QUERY_CONSULT_DETAILS, "", params, handler, MSG.MSG_QUERY_CONSULT_DETAILS_SUCCESS, MSG.MSG_QUERY_CONSULT_DETAILS_FIELD);

    }
}
